﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OpenSource.UPnP;
using System.Xml;
using System.Windows.Markup;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows.Threading;
using System.Runtime.CompilerServices;
using System.Collections;


namespace ApplicationClienteCommunicante2
{

    public class ServeurApplicationCommunicante2
    {
        private UPnPDevice root;
        private UPnPService list;
        ArrayList parametres = new ArrayList();
        ArrayList surfaceparametres = new ArrayList();


        /**
            * \ServeurDispositifAffichage      le constructeur du classe 'ServeurDispositifAffichage'

        */
        public ServeurApplicationCommunicante2()
        {

            root = UPnPDevice.CreateRootDevice(360, 1.0, "");
            root.FriendlyName = "ApplicationCommunicante2";
            root.DeviceURN = "urn:schemas-upnp-org:device:ApplicationCommunicante2:1";
            root.HasPresentation = false;
            root.Manufacturer = "sbai";
            root.ModelName = "UPnP sample for kids";
            root.UniqueDeviceName = "12345678-153f-430d-82f3-dff320c17705";

            list = new UPnPService(1.0, "Sample", "urn:schemas-upnp-org:service:Sample:1", true, this);

            list.AddMethod("loadParametreInterface");

            root.AddService(list);
            root.Advertise();
        }



        /**
        * \startUPnP       pour démarrer le device

        */
        public void startUPnP()
        {
            root.StartDevice();
            Console.WriteLine("Serveur start");
        }

        /**
        * \stopUPnP       pour arrêter le device
        */
        public void stopUPnP()
        {
            root.StopDevice();
            Console.WriteLine("Serveur stopped");

        }


        /**
        * \loadFile       pour télécharger le fichier de description
        * \param         InFile est le fichier de descrption passé sous forme d'une chaîne de caractères
        */
        public void loadParametreInterface(int width, int height)
        {
            Console.WriteLine("le width est : " + width);
            Console.WriteLine("le height: " + height);
        }

    }
}
